<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>进度追踪 | StudyRaid</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        :root {
            --bg-primary: #0d1117;
            --bg-secondary: #161b22;
            --bg-tertiary: #21262d;
            --text-primary: #f0f6fc;
            --text-secondary: #c9d1d9;
            --text-tertiary: #8b949e;
            --border-color: #30363d;
            --accent-color: #58a6ff;
            --success-color: #3fb950;
            --warning-color: #d29922;
            --danger-color: #f85149;
            --border-radius: 6px;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        }

        body {
            background-color: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.5;
        }

        .container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 导航栏样式 */
        header {
            background-color: var(--bg-secondary);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 0;
        }

        .logo {
            font-size: 24px;
            font-weight: 700;
            color: var(--text-primary);
            text-decoration: none;
            display: flex;
            align-items: center;
        }

        .logo i {
            margin-right: 10px;
            color: var(--accent-color);
        }

        .nav-links {
            display: flex;
            gap: 24px;
        }

        .nav-links a {
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 14px;
            transition: color 0.2s;
        }

        .nav-links a:hover,
        .nav-links a.active {
            color: var(--text-primary);
        }

        .user-menu {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .search-box {
            position: relative;
        }

        .search-box input {
            background-color: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 8px 12px;
            padding-left: 32px;
            color: var(--text-primary);
            width: 240px;
            font-size: 14px;
        }

        .search-box i {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-tertiary);
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background-color: var(--accent-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            cursor: pointer;
        }

        /* 个人中心布局 */
        .profile-container {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 24px;
            margin: 24px 0;
        }

        /* 侧边栏 */
        .profile-sidebar {
            background-color: var(--bg-secondary);
            border-radius: var(--border-radius);
            border: 1px solid var(--border-color);
            overflow: hidden;
            height: fit-content;
            position: sticky;
            top: 90px;
        }

        .profile-info {
            padding: 24px;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
        }

        .profile-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background-color: var(--accent-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
            font-weight: bold;
            margin: 0 auto 16px;
        }

        .profile-name {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .profile-username {
            color: var(--text-tertiary);
            font-size: 14px;
            margin-bottom: 16px;
        }

        .profile-bio {
            color: var(--text-secondary);
            font-size: 14px;
            line-height: 1.5;
        }

        .profile-stats {
            display: flex;
            justify-content: space-around;
            padding: 16px;
            border-bottom: 1px solid var(--border-color);
        }

        .stat-item {
            text-align: center;
        }

        .stat-value {
            font-size: 20px;
            font-weight: 600;
            color: var(--accent-color);
        }

        .stat-label {
            font-size: 12px;
            color: var(--text-tertiary);
        }

        .profile-menu {
            padding: 16px 0;
        }

        .menu-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 20px;
            color: var(--text-secondary);
            text-decoration: none;
            transition: all 0.2s;
            cursor: pointer;
        }

        .menu-item:hover,
        .menu-item.active {
            background-color: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .menu-item i {
            width: 20px;
            text-align: center;
        }

        /* 主要内容区域 */
        .profile-content {
            background-color: var(--bg-secondary);
            border-radius: var(--border-radius);
            border: 1px solid var(--border-color);
            overflow: hidden;
        }

        .content-section {
            padding: 24px;
            border-bottom: 1px solid var(--border-color);
        }

        .content-section:last-child {
            border-bottom: none;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
        }

        .section-action {
            color: var(--accent-color);
            font-size: 14px;
            text-decoration: none;
        }

        /* 进度概览卡片 */
        .progress-overview {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        .progress-card {
            background-color: var(--bg-tertiary);
            border-radius: var(--border-radius);
            padding: 20px;
            text-align: center;
        }

        .progress-card-icon {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background-color: rgba(88, 166, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 12px;
            color: var(--accent-color);
            font-size: 20px;
        }

        .progress-card-value {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .progress-card-label {
            color: var(--text-tertiary);
            font-size: 14px;
        }

        /* 图表容器 */
        .chart-container {
            background-color: var(--bg-tertiary);
            border-radius: var(--border-radius);
            padding: 20px;
            margin-bottom: 24px;
            height: 300px;
            position: relative;
        }

        .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .chart-title {
            font-size: 16px;
            font-weight: 600;
        }

        .chart-actions {
            display: flex;
            gap: 8px;
        }

        .chart-action {
            background-color: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 6px 12px;
            color: var(--text-secondary);
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .chart-action:hover {
            background-color: var(--bg-primary);
        }

        .chart-action.active {
            background-color: var(--accent-color);
            color: white;
            border-color: var(--accent-color);
        }

        /* 课程进度列表 */
        .course-progress-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .course-progress-item {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 16px;
            background-color: var(--bg-tertiary);
            border-radius: var(--border-radius);
        }

        .course-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: rgba(63, 185, 80, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--success-color);
        }

        .course-content {
            flex: 1;
        }

        .course-title {
            font-weight: 500;
            margin-bottom: 4px;
        }

        .course-progress-bar {
            height: 6px;
            background-color: var(--bg-secondary);
            border-radius: 3px;
            overflow: hidden;
            margin-top: 8px;
        }

        .course-progress-fill {
            height: 100%;
            background-color: var(--success-color);
        }

        .course-stats {
            text-align: right;
        }

        .course-percent {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .course-time {
            color: var(--text-tertiary);
            font-size: 14px;
        }

        /* 学习日历 */
        .calendar-container {
            background-color: var(--bg-tertiary);
            border-radius: var(--border-radius);
            padding: 20px;
            margin-bottom: 24px;
        }

        .calendar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .calendar-nav {
            display: flex;
            gap: 12px;
        }

        .calendar-nav-btn {
            background-color: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .calendar-nav-btn:hover {
            background-color: var(--bg-primary);
        }

        .calendar-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 8px;
        }

        .calendar-day-header {
            text-align: center;
            font-size: 12px;
            color: var(--text-tertiary);
            padding: 8px 0;
        }

        .calendar-day {
            aspect-ratio: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: var(--border-radius);
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .calendar-day:hover {
            background-color: var(--bg-secondary);
        }

        .calendar-day.active {
            background-color: var(--accent-color);
            color: white;
        }

        .calendar-day.has-activity {
            position: relative;
        }

        .calendar-day.has-activity::after {
            content: '';
            position: absolute;
            bottom: 4px;
            left: 50%;
            transform: translateX(-50%);
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background-color: var(--success-color);
        }

        .calendar-day.empty {
            background-color: transparent;
            cursor: default;
        }

        .calendar-day.empty:hover {
            background-color: transparent;
        }

        /* 学习习惯分析 */
        .habits-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 16px;
        }

        .habit-card {
            background-color: var(--bg-tertiary);
            border-radius: var(--border-radius);
            padding: 20px;
        }

        .habit-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .habit-title {
            font-size: 16px;
            font-weight: 600;
        }

        .habit-value {
            font-size: 20px;
            font-weight: 600;
            color: var(--accent-color);
        }

        .habit-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .habit-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .habit-item:last-child {
            border-bottom: none;
        }

        .habit-label {
            font-size: 14px;
        }

        .habit-amount {
            font-size: 14px;
            color: var(--text-tertiary);
        }

        /* 页脚 */
        footer {
            border-top: 1px solid var(--border-color);
            padding: 24px 0;
            margin-top: 40px;
            text-align: center;
            color: var(--text-tertiary);
            font-size: 14px;
        }

        /* 响应式设计 */
        @media (max-width: 1024px) {
            .profile-container {
                grid-template-columns: 1fr;
            }

            .profile-sidebar {
                order: -1;
                position: static;
            }
        }

        @media (max-width: 768px) {
            .navbar {
                flex-direction: column;
                gap: 16px;
            }

            .nav-links {
                order: 3;
                width: 100%;
                justify-content: center;
            }

            .search-box input {
                width: 200px;
            }

            .progress-overview {
                grid-template-columns: 1fr;
            }

            .chart-container {
                height: 250px;
            }

            .calendar-grid {
                gap: 4px;
            }

            .habits-container {
                grid-template-columns: 1fr;
            }

            .course-progress-item {
                flex-direction: column;
                align-items: flex-start;
            }

            .course-stats {
                text-align: left;
                width: 100%;
                margin-top: 12px;
            }
        }
    </style>
</head>

<body>
    <!-- 导航栏 -->
    <header>
        <div class="container">
            <nav class="navbar">
                <a href="index.html" class="logo">
                    <i class="fas fa-graduation-cap"></i>
                    StudyRaid
                </a>

                <div class="nav-links">
                    <a href="my-courses.html">我的课程</a>
                    <a href="explore.html">发现</a>
                    <a href="learning-path.html">学习路径</a>
                    <a href="progress-tracking.html" class="active">进度追踪</a>
                </div>

                <div class="user-menu">
                    <div class="search-box">
                        <i class="fas fa-search"></i>
                        <input type="text" placeholder="搜索课程...">
                    </div>
                    <div class="user-avatar">JS</div>
                </div>
            </nav>
        </div>
    </header>

    <!-- 个人中心内容 -->
    <main class="container">
        <div class="profile-container">
            <!-- 侧边栏 -->
            <div class="profile-sidebar">
                <div class="profile-info">
                    <div class="profile-avatar">JS</div>
                    <h2 class="profile-name">张三</h2>
                    <p class="profile-username">@zhangsan</p>
                    <p class="profile-bio">前端开发工程师 | 终身学习者 | 热爱编程与分享</p>
                </div>

                <div class="profile-stats">
                    <div class="stat-item">
                        <div class="stat-value">13</div>
                        <div class="stat-label">课程</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">65%</div>
                        <div class="stat-label">完成率</div>
                    </div>
                    <div class="stat-item">
                        <div class="stat-value">42</div>
                        <div class="stat-label">学习天数</div>
                    </div>
                </div>

                <div class="profile-menu">
                    <a href="profile.html" class="menu-item">
                        <i class="fas fa-user"></i>
                        <span>个人信息</span>
                    </a>
                    <a href="my-stat.html" class="menu-item">
                        <i class="fas fa-chart-line"></i>
                        <span>学习统计</span>
                    </a>
                    <a href="my-cert.html" class="menu-item">
                        <i class="fas fa-certificate"></i>
                        <span>我的证书</span>
                    </a>
                    <a href="account-settings.html" class="menu-item">
                        <i class="fas fa-cog"></i>
                        <span>账户设置</span>
                    </a>
                    <a href="help.html" class="menu-item">
                        <i class="fas fa-question-circle"></i>
                        <span>帮助与支持</span>
                    </a>
                    <a href="logout.html" class="menu-item">
                        <i class="fas fa-sign-out-alt"></i>
                        <span>退出登录</span>
                    </a>
                </div>
            </div>

            <!-- 主要内容区域 -->
            <div class="profile-content">
                <!-- 进度概览部分 -->
                <div class="content-section">
                    <div class="section-header">
                        <h3 class="section-title">进度概览</h3>
                        <div class="chart-actions">
                            <button class="chart-action active" data-period="week">本周</button>
                            <button class="chart-action" data-period="month">本月</button>
                            <button class="chart-action" data-period="year">全年</button>
                        </div>
                    </div>

                    <div class="progress-overview">
                        <div class="progress-card">
                            <div class="progress-card-icon">
                                <i class="fas fa-clock"></i>
                            </div>
                            <div class="progress-card-value">12.5</div>
                            <div class="progress-card-label">学习时长 (小时)</div>
                        </div>
                        <div class="progress-card">
                            <div class="progress-card-icon">
                                <i class="fas fa-book-open"></i>
                            </div>
                            <div class="progress-card-value">8</div>
                            <div class="progress-card-label">完成课程数</div>
                        </div>
                        <div class="progress-card">
                            <div class="progress-card-icon">
                                <i class="fas fa-fire"></i>
                            </div>
                            <div class="progress-card-value">7</div>
                            <div class="progress-card-label">连续学习天数</div>
                        </div>
                        <div class="progress-card">
                            <div class="progress-card-icon">
                                <i class="fas fa-trophy"></i>
                            </div>
                            <div class="progress-card-value">87%</div>
                            <div class="progress-card-label">平均完成率</div>
                        </div>
                    </div>

                    <div class="chart-container">
                        <div class="chart-header">
                            <div class="chart-title">学习时间趋势</div>
                        </div>
                        <canvas id="learningTrendChart"></canvas>
                    </div>
                </div>

                <!-- 课程进度部分 -->
                <div class="content-section">
                    <div class="section-header">
                        <h3 class="section-title">课程进度</h3>
                        <a href="my-courses.html" class="section-action">查看全部</a>
                    </div>

                    <div class="course-progress-list">
                        <div class="course-progress-item">
                            <div class="course-icon">
                                <i class="fab fa-js"></i>
                            </div>
                            <div class="course-content">
                                <div class="course-title">JavaScript 高级编程</div>
                                <div class="course-progress-bar">
                                    <div class="course-progress-fill" style="width: 65%"></div>
                                </div>
                            </div>
                            <div class="course-stats">
                                <div class="course-percent">65%</div>
                                <div class="course-time">12/20 节课</div>
                            </div>
                        </div>

                        <div class="course-progress-item">
                            <div class="course-icon">
                                <i class="fab fa-python"></i>
                            </div>
                            <div class="course-content">
                                <div class="course-title">Python 数据分析</div>
                                <div class="course-progress-bar">
                                    <div class="course-progress-fill" style="width: 30%"></div>
                                </div>
                            </div>
                            <div class="course-stats">
                                <div class="course-percent">30%</div>
                                <div class="course-time">6/20 节课</div>
                            </div>
                        </div>

                        <div class="course-progress-item">
                            <div class="course-icon">
                                <i class="fab fa-react"></i>
                            </div>
                            <div class="course-content">
                                <div class="course-title">React Native 开发</div>
                                <div class="course-progress-bar">
                                    <div class="course-progress-fill" style="width: 80%"></div>
                                </div>
                            </div>
                            <div class="course-stats">
                                <div class="course-percent">80%</div>
                                <div class="course-time">16/20 节课</div>
                            </div>
                        </div>

                        <div class="course-progress-item">
                            <div class="course-icon">
                                <i class="fab fa-node-js"></i>
                            </div>
                            <div class="course-content">
                                <div class="course-title">Node.js 与 Express</div>
                                <div class="course-progress-bar">
                                    <div class="course-progress-fill" style="width: 100%"></div>
                                </div>
                            </div>
                            <div class="course-stats">
                                <div class="course-percent">100%</div>
                                <div class="course-time">已完成</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 学习日历部分 -->
                <div class="content-section">
                    <div class="section-header">
                        <h3 class="section-title">学习日历</h3>
                        <div class="calendar-nav">
                            <button class="calendar-nav-btn" id="prevMonth">
                                <i class="fas fa-chevron-left"></i>
                            </button>
                            <span id="currentMonth">2023年10月</span>
                            <button class="calendar-nav-btn" id="nextMonth">
                                <i class="fas fa-chevron-right"></i>
                            </button>
                        </div>
                    </div>

                    <div class="calendar-container">
                        <div class="calendar-grid" id="calendarGrid">
                            <!-- 日历将通过JavaScript动态生成 -->
                        </div>
                    </div>
                </div>

                <!-- 学习习惯部分 -->
                <div class="content-section">
                    <div class="section-header">
                        <h3 class="section-title">学习习惯</h3>
                    </div>

                    <div class="habits-container">
                        <div class="habit-card">
                            <div class="habit-header">
                                <div class="habit-title">最佳学习时段</div>
                                <div class="habit-value">19:00-21:00</div>
                            </div>
                            <div class="chart-container">
                                <canvas id="timeDistributionChart"></canvas>
                            </div>
                        </div>

                        <div class="habit-card">
                            <div class="habit-header">
                                <div class="habit-title">每周学习分布</div>
                                <div class="habit-value">5.2天/周</div>
                            </div>
                            <div class="chart-container">
                                <canvas id="weeklyDistributionChart"></canvas>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <p>© 2023 StudyRaid. 保留所有权利。</p>
            <p>采用 GitHub 深色风格设计</p>
        </div>
    </footer>

    <script>
        // 菜单项点击功能
        document.querySelectorAll('.menu-item').forEach(item => {
            item.addEventListener('click', function () {
                document.querySelectorAll('.menu-item').forEach(i => {
                    i.classList.remove('active');
                });
                this.classList.add('active');
            });
        });

        // 时间周期切换
        document.querySelectorAll('.chart-action').forEach(button => {
            button.addEventListener('click', function () {
                document.querySelectorAll('.chart-action').forEach(btn => {
                    btn.classList.remove('active');
                });
                this.classList.add('active');

                // 根据选择的时间周期更新图表
                updateCharts(this.dataset.period);
            });
        });

        // 初始化图表
        function initCharts() {
            // 学习趋势图表
            const trendCtx = document.getElementById('learningTrendChart').getContext('2d');
            const trendChart = new Chart(trendCtx, {
                type: 'line',
                data: {
                    labels: ['10-01', '10-02', '10-03', '10-04', '10-05', '10-06', '10-07'],
                    datasets: [{
                        label: '学习时长 (小时)',
                        data: [1.5, 2.0, 1.2, 2.5, 1.8, 2.2, 1.5],
                        borderColor: '#58a6ff',
                        backgroundColor: 'rgba(88, 166, 255, 0.1)',
                        borderWidth: 2,
                        fill: true,
                        tension: 0.4
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        },
                        x: {
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        }
                    }
                }
            });

            // 时间分布图表
            const timeCtx = document.getElementById('timeDistributionChart').getContext('2d');
            const timeChart = new Chart(timeCtx, {
                type: 'bar',
                data: {
                    labels: ['06-08', '08-10', '10-12', '12-14', '14-16', '16-18', '18-20', '20-22', '22-24'],
                    datasets: [{
                        label: '学习时长 (小时)',
                        data: [0.2, 0.5, 0.8, 0.3, 0.7, 1.2, 2.5, 1.8, 0.5],
                        backgroundColor: '#58a6ff',
                        borderColor: '#58a6ff',
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        },
                        x: {
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        }
                    }
                }
            });

            // 每周分布图表
            const weeklyCtx = document.getElementById('weeklyDistributionChart').getContext('2d');
            const weeklyChart = new Chart(weeklyCtx, {
                type: 'bar',
                data: {
                    labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
                    datasets: [{
                        label: '学习时长 (小时)',
                        data: [2.1, 1.8, 2.5, 1.2, 2.0, 1.5, 1.0],
                        backgroundColor: '#3fb950',
                        borderColor: '#3fb950',
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        },
                        x: {
                            grid: {
                                color: 'rgba(48, 54, 61, 0.5)'
                            },
                            ticks: {
                                color: '#8b949e'
                            }
                        }
                    }
                }
            });

            return { trendChart, timeChart, weeklyChart };
        }

        // 更新图表数据
        function updateCharts(period) {
            // 这里可以根据不同的时间周期更新图表数据
            console.log(`更新图表数据，时间周期: ${period}`);
        }

        // 初始化日历
        function initCalendar() {
            const calendarGrid = document.getElementById('calendarGrid');
            const currentMonthEl = document.getElementById('currentMonth');
            const prevMonthBtn = document.getElementById('prevMonth');
            const nextMonthBtn = document.getElementById('nextMonth');

            let currentDate = new Date();

            // 星期标题
            const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
            weekdays.forEach(day => {
                const dayHeader = document.createElement('div');
                dayHeader.className = 'calendar-day-header';
                dayHeader.textContent = day;
                calendarGrid.appendChild(dayHeader);
            });

            // 渲染日历
            function renderCalendar(date) {
                // 清空日历
                while (calendarGrid.children.length > 7) {
                    calendarGrid.removeChild(calendarGrid.lastChild);
                }

                // 更新月份标题
                const year = date.getFullYear();
                const month = date.getMonth();
                currentMonthEl.textContent = `${year}年${month + 1}月`;

                // 获取当月第一天和最后一天
                const firstDay = new Date(year, month, 1);
                const lastDay = new Date(year, month + 1, 0);

                // 获取第一天是星期几（0-6，0是星期日）
                const firstDayOfWeek = firstDay.getDay();

                // 填充空白日期
                for (let i = 0; i < firstDayOfWeek; i++) {
                    const emptyDay = document.createElement('div');
                    emptyDay.className = 'calendar-day empty';
                    calendarGrid.appendChild(emptyDay);
                }

                // 填充当月日期
                for (let day = 1; day <= lastDay.getDate(); day++) {
                    const dayEl = document.createElement('div');
                    dayEl.className = 'calendar-day';
                    dayEl.textContent = day;

                    // 模拟有学习活动的日期（随机）
                    if (Math.random() > 0.7) {
                        dayEl.classList.add('has-activity');
                    }

                    // 标记今天
                    const today = new Date();
                    if (today.getFullYear() === year && today.getMonth() === month && today.getDate() === day) {
                        dayEl.classList.add('active');
                    }

                    calendarGrid.appendChild(dayEl);
                }
            }

            // 初始渲染
            renderCalendar(currentDate);

            // 上个月按钮
            prevMonthBtn.addEventListener('click', () => {
                currentDate.setMonth(currentDate.getMonth() - 1);
                renderCalendar(currentDate);
            });

            // 下个月按钮
            nextMonthBtn.addEventListener('click', () => {
                currentDate.setMonth(currentDate.getMonth() + 1);
                renderCalendar(currentDate);
            });
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function () {
            initCharts();
            initCalendar();
        });
    </script>
</body>

</html>